package org.example.utils;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class SensitiveWordFilter {
    // 或使用 Collections.unmodifiableSet 创建不可变集合
    private static final Set<String> SENSITIVE_WORDS = Collections.unmodifiableSet(
            new HashSet<>(Arrays.asList("操你妈", "尼玛","去死","你妈逼"))
    );

    public static String filter(String text) {
        for (String word : SENSITIVE_WORDS) {
            text = text.replaceAll(word, "***");
        }
        return text;
    }
}